home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-levinson-sgml-00.txt < prev    next >
Text File  |  1993-10-19  |  31KB  |  741 lines

  1.  
  2. Network Working Group                    E. Levinson
  3. Internet Draft: MIME/SGML      Accurate Information Systems, Inc
  4. <draft-levinson-sgml-00.txt>                   October 19, 1993
  5.                                                  Expire: April 1993
  6. MIME Content-types for SGML Documents
  7.  
  8. This draft document is being circulated for comment.  Please send
  9. your comments to the authors or to the ietf-822 maillist <ietf-
  10. 822@dimacs.rutgers.edu>.  If consensus is reached this document
  11. may be submitted to the RFC editor as a Proposed Standard protocol
  12. specification for use with MIME.
  13.  
  14. Status of this Memo
  15.  
  16.    This document is an Internet Draft; Internet Drafts are working
  17.    documents of the Internet Engineering Task Force (IETF) its
  18.    Areas, and Working Groups.  Note that other groups may also
  19.    distribute working documents as Internet Drafts.
  20.  
  21.    Internet Drafts are draft documents valid for a maximum of six
  22.    months.  They may be updated, replaced, or obseoleted by other
  23.    documents at any time.  It is not appropriate to use Internet
  24.    Drafts as reference material or to cite them other than as a
  25.    Rworking draftS or  Rwork in progressS.
  26.  
  27.    Please check the abstract listing in each Internet Draft
  28.    directory for the current status of this or any other Internet
  29.    Draft.
  30.  
  31. Abstract
  32.  
  33.    This document specifies how a specific compound object, a complete
  34.    SGML document, is to be carried within a MIME message. MIME
  35.    provides a flexible mechanism for structuring RFC 822 message
  36.    bodies.  To use that mechanism for compound documents requires
  37.    additional agreements on how the compound document is
  38.    represented and labelled within the message body.  In addition,
  39.    this document specifies the requirements for using MIME to carry SGML
  40.    documents within a data stream in conformance with the SGML
  41.    Document Interchange Format (SDIF).  That format provides a mechanism
  42.    for transferring one or more SGML documents.  Subtypes are
  43.    proposed for the Multipart and Application content types to
  44.    support SGML documents and SDIF within MIME.
  45.  
  46.    Compound documents, including SGML, consist of a number of
  47.    files, some of which may contain references to other files. 
  48.    Explicit indications of the bindings between the sender's file
  49.    names and the MIME body parts are needed to re-bind the sender's
  50.    file names to ones on the recipient's system.  A content
  51.    reference header field makes the bindings explicit.
  52.  
  53. 1    Introduction
  54.  
  55. Many MIME [RFC-MIME] based mail User Agents can be readily
  56. configured to display (and compose) standard message body content
  57. types.  These user agents  invoke applications that correspond to
  58. the particular content type.  Standard content types exist for
  59. data that consists of a single body part and there are mechanisms
  60. to convey multiple body parts.  However there is no standard
  61. mechanism for objects like compound documents that contain
  62. multiple, inter-related body parts.
  63.  
  64. Compound documents are represented in various mark-up languages,
  65. e.g. troff, text/enriched.   This document provides a mechanism for
  66. embedding, inside an Internet mail [RFC-822, RFC-MIME] message,
  67. complete documents of one such markup language, the Standard
  68. Generalized Markup Language (SGML) [ISO-SGML].
  69.  
  70. 1.1 SGML
  71.  
  72. SGML is used in several communities to encode document structure
  73. and layout.  A rigorous description of SGML is left to [ISO-SGML];
  74. Appendix A contains an unbelievably brief description of the SGML
  75. elements relevant to this document.   In this document attempts to be
  76. consistent with SGML terminology and usage.  A complete SGML
  77. document consists of an SGML declaration, a document type
  78. definition (DTD), and a document instance.  The document instance
  79. may, recursively, contain subdocuments which consist of DTDs and
  80. an instance.  The applications that process SGML documents may
  81. require the document parts to be individual files or combined in a
  82. single file.
  83.  
  84. For a person or application (a recipient) to receive and display a
  85. complete SGML document  a precise definition for each of the SGML
  86. document parts must be carried within the mail message.  In the
  87. sender's environment these parts may be references to standard
  88. parts or specific files in the sender's file system.  Further, a
  89. DTD may reference other files, for example, images and graphics.
  90. The identity of the document parts as well as the name and
  91. contents of each file must be transferred.  Sufficient information
  92. must be accompany the data for the recipient to transform the
  93. sender's file name into an equivalent local reference.
  94.  
  95. 1.2 SDIF
  96.  
  97. The SGML Document Interchange Format, SDIF, [ISO-SDIF] specifies
  98. the structure for a data stream whcih contains one or more SGML
  99. documents.  SDIF is focused on transferring documents between
  100. sites and does not include a requirement that the documents be
  101. displayed as they are encountered.  Users of mail based systems,
  102. however,  expect to have each mail item in a multipart message
  103. displayed -- more precisely, ready for display -- when
  104. encouneterd.  This document shows how to meet both the SDIF and display
  105. requirements.
  106.  
  107. 1.3 Organization of this Memorandum
  108.  
  109. First a body part content type for a simple SGML document is
  110. defined.  The discussion of that content type expains the SGML
  111. specific parameters and explores a number of the issues that arise
  112. when transferring an SGML document from one system to another. 
  113. More complex documents are handled via a Multipart subtype. 
  114. Discussion of that subtype explores additional document transfer
  115. issues.  The discussion concludes by presenting the content types
  116. required to create an SDIF conformant data stream.
  117.  
  118. 2    Processing Model for MIME/SGML
  119.  
  120. Four issues must be addressed for the recipientUs user agent to
  121. display a complete SGML document: the various parts must be
  122. specified and file and command references on the sender's systems
  123. must be resolved to references on the receiverUs system.  Finally,
  124. an appropriate application, an unpacker, must be in control to
  125. unpack of the MIME body parts containing the document and present
  126. them to the display software.  The controlling application is
  127. discussed first and then the document parts, file references, and
  128. command references.
  129.  
  130. 2.1 Invoking the  SGML Parser Application
  131.  
  132. MIME offers the possibility to add SGML capability to existing
  133. mail user agents.  To accomplish this with existing SGML viewers
  134. and composers a process must be interposed between the SGML
  135. application and the user agent to translate from MIME format to a
  136. form acceptable to the local SGML application.  This document uses the
  137. notation in [ISO-SDIF] where the process creating the data stream
  138. (here, the MIME message) is called the packer; the correponding
  139. one for  the receiver, the unpacker.
  140.  
  141. Normally one expects a MIME capable user-agent to display each
  142. body part in turn, usually in a depth first manner.  For a
  143. compound document the display must be deferred until all the body
  144. parts are available to the application and are structured
  145. according to the requirements of the SGML application.  For example,
  146. some SGML viewers expect the DTD and instance be combined in a single
  147. file, others expect them to be separate.  "Available" means that the
  148. files corresponding to the various document parts have been
  149. instantiated on the receiver's system.  Once instantiated, an SGML
  150. viewer can be invoked.  Similarly, an SGML composer will create
  151. the respective parts using its own file structure.  For example,
  152. an SGML application may expect the DTD and document instance to be
  153. in a single file.  The unpacker separates these parts and
  154. encapsulates as separate MIME body parts.
  155.  
  156. 2.2 Specifying the Document Parts
  157.  
  158. Different implementations of SGML parsers use different  methods
  159. for storing the SGML declaration, DTD, and document instance. 
  160. Consequently the unpacker may find these parts as separate body
  161. parts or as a single part and must store them as the local
  162. application requires.  There are several ways to specify each part
  163. of a complete SGML document.  The declaration part may be a
  164. default value and not included, an file which is included, or it
  165. may be part of the document instance.  It could also be a file
  166. each correspondent already has.
  167.  
  168. An easy solution would be to require a standard form, perhaps a
  169. single file, a concatenation of the declaration, DTD, and
  170. instance.  That would often require the transferring much more
  171. data than needed, often only the document intsance is required. 
  172. The discussion so far assumes that there is only one file (or its
  173. equivalent).  While there may be many files, for SGML document
  174. instances as opposed to files of image (or other) data, the
  175. consideration here is only how to specify the document or sub-
  176. document SGML elements.  The next section considers other data .
  177.  
  178. Rather than require a standard form, this document permits the SGML
  179. document parts to specified as parameters.  Thus a sender may
  180. choose to send the declaration, DTD, and instance as a single file
  181. or may choose to specify any of them as a parameter.  If neither
  182. the SGML declaration nor document type declaration is specified it
  183. may be in the message body; if it is not there then the recipient
  184. is free to apply a local default.
  185.  
  186. These parameters are provided for each document or subdocument
  187. instance.
  188.  
  189.     sgml-parm    :=    *( ";" sgml-part "=" sgml-part-spec)
  190.              [ ";" "version" "=" iso-sgml-spec ]
  191.              [ ";" "created-with" "=" ref-or-tok ]
  192.              [ ";" "character-set" "=" charset ]
  193.  
  194.     sgml-part    :=    "instance" / "declaration"
  195.             /    "dtd" / "fosi" / extension-token
  196.  
  197.     sgml-part-spec    :=    file-token / sgml-public / extension-token
  198.  
  199.     sgml-public    :=    <An SGML PUBLIC identifier>
  200.  
  201.     iso-sgml-spec    :=    <The identifier of the SGML specification
  202.                 to which the document conforms, e.g. ISO
  203.                 8879-1986>
  204.  
  205. Sgml-parts specify the various parts of a complete document.  File-
  206. tokens are discussed in the next section.  If used that file's
  207. contents will be contained in a body part and will be labelled
  208. with a content-reference: field.  Sgml-public are identifiers
  209. defined in [ISO SGML] which represent well known files or
  210. entities.  The SGML parser is expected to resolve these references
  211. on its own.  Although  the SGML definition provides for
  212. associating location (local file system) information with public
  213. data this document does not supported it.  It is possible to provide
  214. support for that capability in the unpacker.
  215.  
  216. The two parameters, version and created-with, are provided for
  217. guidance to user agents.  Version specifies the particular SGML
  218. standard to which the document conforms.  A user agent can use
  219. this value to invoke the application appropriate to that version
  220. of the standard.  The created-with parameter provides guidance in
  221. cases where inter-operability with respect to SGML may be a
  222. problem.  In those environments, where user's maintain several of
  223. SGML processors, this parameter can be used to invoke the
  224. appropriate implementation.
  225.  
  226. The character-set parameter specifies the body part character
  227. set.  If not specified, the default is us-ascii.
  228.  
  229. 2.3 Resolving File References
  230.  
  231. SGML permits the DTD to define document parts (entities) that a
  232. document instance can reference for inclusion or interpolation.  
  233. The entities point to files that can contain SGML coded text, text
  234. not to be interpreted, images, or other data.  Within SGML there
  235. are two types of file reference entitites SYSTEM and PUBLIC. 
  236. PUBLIC entities specify SGML document parts that are known to and
  237. resolvable by SGML viewers and editors.  The SYSTEM identifiers
  238. refer to files in the local environment.  In order for the
  239. recipient's SGML application to properly process the document, the
  240. file references must be resolvable in the recipient's environment. 
  241. Conceptually, one must replace each of the sender's file
  242. references with a corresponding reference in the recipient's file
  243. system.
  244.  
  245. There are two issues here.  First, the sending user agent must
  246. parse the document and identity the sender's file references. 
  247. Second, the internally referenced file will become a MIME body
  248. part and the correspondence between the file name and the body
  249. part must be preserved.  This document applies the principle of "sender
  250. makes right" to these issues and requires first, that the packer
  251. converts all file references into a unique token containing only
  252. US-ASCII characters.  Second, those files will be a body part in a
  253. multipart MIME message and the corresponding body part header must
  254. contain a Content-Reference: field whose value contains the file's
  255. token.  Thus, the internal file name, now a token which can appear
  256. in an 822 header, explicitly appears in the document and its
  257. corresponding MIME body part using the Content-Reference: field. 
  258. When the unpacker stores the body part in the recipient's file
  259. system it can convert the internal file references (tokens) into
  260. valid local references.
  261.  
  262. 2.4 Processors for Non-SGML Data
  263.  
  264. Non-SGML data requires the SGML parser to invoke a processor to
  265. format the data.  The correspondence between the file name and the
  266. application is contained in the type field of the SGML entity
  267. declaration  and the SGML notation declaration  for that type. 
  268. The notation declaration  contains the operating system command
  269. string to invoke or launch the processor.  That is, the string in
  270. the notation declaration  is an arbitrary  command.  There are two
  271. problems with this situation, the command may only be valid in the
  272. sender's environment  and, if it is valid in the recipient's ,
  273. invoking that command is a security hazard.
  274.  
  275. Therefore, this document requires that any type used in an SGML
  276. notation be an valid MIME content type (or an extension token) and
  277. that the unpacker substitute a local string for the string in the
  278. notation declaration.
  279.  
  280. 3    The SGML Subtypes
  281.  
  282. A complete document may be a single instance in which all the
  283. other document parts are defined by existing standards or private
  284. agreements.  It may also be a set of parts several of which must
  285. be included in the MIME message.  Two SGML subtypes are defined,
  286. content types application and multipart.  Both
  287. body part content types use the same parameters.  The multipart
  288. subtype is considered first, it is the general case.  The
  289. application subtype is a simplification for the case where the
  290. multipart would contain a single part.  It is also used to contain
  291. SGML subdocument entities, that is text with mark-up.
  292.  
  293. 3.1 The Multipart/SGML Subtype
  294.  
  295. An SGML document carried in a MIME message as a Multipart body of
  296. subtype SGML (Content-Type: Multipart/SGML).  The content-
  297. type parameters specify each of the parts of the SGML document. 
  298. Additional parameters specify the software that  created the
  299. document and the applicable SGML standard.
  300.  
  301. In a complex document  some of the SGML document parts are
  302. references to standard parts  and the others as filenames.  In the
  303. latter case the filename tokens must appear in exactly one Content-
  304. Reference: header in an enclosed body part.  Inside the document
  305. itself, the file names must be replaced by their tokens.
  306.  
  307. Thus a complete SGML document can appear as the following MIME
  308. message.
  309.  
  310.     Content-Type: Multipart/SGML; instance=SSBradio;
  311.     dtd=sgml-dtd-mtce-radio; boundary=tiger-lily
  312.  
  313.      --tiger-lily
  314.  
  315.     Content-type: Application/SGML
  316.     Content-reference: SSBradio
  317.  
  318.     <! ... an SGML instance >
  319.  
  320.     --tiger-lily
  321.     Content-type: Image/gif
  322.     Content-reference: sgml-radio-figure-1
  323.  
  324.     ...
  325.     --tiger-lily
  326.     Content-type: Application/SGML
  327.     Content-reference: sgml-dtd-mtce-radio
  328.  
  329.     <! ... a DTD that references the file Figure1>
  330.  
  331.     --tiger-lily--
  332.  
  333. 3.2 The Application/SGML Subtype
  334.  
  335. When transferring a file containing text and mark-up within a
  336. Multipart/SGML message or when a complete SGML document can be
  337. contained in a single message the content-type: Application/sgml
  338. can be used.  
  339.  
  340. application-subtype    := ("octet-stream" *stream)
  341.         /    "postscript"
  342.         /    ("sgml" *sgml-parm)
  343.         /    extension-token
  344.  
  345.  
  346. The following example shows a MIME message an document instance
  347. which specifies a dtd.
  348.  
  349.     Content-Type: application/SGML;
  350.         dtd="//USA-DOD//DTD MIL-M-21742 911991//EN" 
  351.     
  352.     <! ... an SGML instance >
  353.  
  354. 3.3 Character Set Considerations
  355.  
  356. It is expected that SGML documents will use the ASCII character
  357. set.  For documents not in the US-ASCII character set, the
  358. charset= parameter of the Content-Type: field specifies the actual
  359. character set.  Note that the values of the charset parameter must
  360. be registered with IANA,  or be a mutually agreed upon extension-
  361. token (i.e., charset=X-set).
  362.  
  363. Values contained in the MIME headers must use be drawn from [US-
  364. ASCII] and conform to[RFC-822].  Where the sender's file names do
  365. not meet this requirement the conventions specified in  [RFC-HDRC]
  366. may be used.
  367.  
  368. 4    The Content-Reference Header Field
  369.  
  370. The Content-Reference: header field provides the linkage between
  371. file references within the SGML document and the MIME body parts. 
  372. It contains the unique file name token which represents the
  373. sender's file name to which the body part corresponds.  The
  374. process that handles the Multipart/Compound-SGML body part will
  375. use this value to convert internal file references into valid
  376. references in the receiver's file system.
  377.  
  378. The syntax is:
  379.  
  380.     reference := "Content-Reference" ":" (token / quoted-string)
  381.  
  382. 5    SDIF [ISO-SDIF] Data Streams
  383.  
  384. [This part need work -- Ed]
  385.  
  386. SDIF is an interchange format standard for SGML documents [ISO-
  387. SDIF].  It defines a data stream that may contain several SGML
  388. documents.  This section defines a Multipart subtype RSDIFS for an
  389. SDIF data stream that contains one or more Multipart/SGML
  390. documents.  Messages that conform to the SDIF subtype will conform
  391. to [ISO-SDIF].
  392.  
  393. Briefly an SDIF data stream is a sequence of SGML documents and
  394. their subdocument and external entities (c.f. Appendix A).  These
  395. external entities are defined in the DTD and are referred to via
  396. their SGML name in the document intstance.  The scope of an enitiy
  397. name is the document or subdocument in which it is defined.  Thus
  398. names are not unique across documents and subdocuments.  To
  399. provide unique names within the SDIF data stream, each entity is
  400. assigned a sequential number.  Each SGML document or subdocument
  401. structure in the SDIF stream lists the number of the first entity
  402. it contains.
  403.  
  404. An SDIF data stream is encoded within a MIME message as a
  405. Multipart/SDIF body part.  It contains one to three body parts. 
  406. The first and last body parts are optional.  They are labelled
  407. with a content description field whose value is "related-documents-A"
  408. and "related-documents-B" respectively and are Multipart/Mixed.
  409. These multipart bodies contain only
  410. Multipart/SGML or Application/SGML (mime/sgml is for convenience
  411. where the particular content type does not matter) body parts.
  412. The second body part, of the three Multipart/SDIF body parts, is a
  413. mime/sgml body part.
  414.  
  415. The Multipart/SDIF content type has a character set parameter
  416. which specifies the character set used for SGML markup tokens
  417. through-out the data stream.
  418.  
  419. There are five SDIF entity types:
  420.  
  421.     subdocument    These can contain references to external
  422.             entities as well as marked up text.
  423.  
  424.     text        An external entity containing only marked
  425.             up text.
  426.  
  427.     data        An external entity containing non-SGML
  428.             data, images, for example.
  429.  
  430.     public-text    Corresponds to a PUBLIC external reference
  431.             and contains a NULL message body.  [A
  432.             reminder to readers without intimate
  433.             knowledge of SGML, PUBLIC text can be
  434.             located by SGML processors without further
  435.             identification.]
  436.  
  437.     cross-reference    Corresponds to a previously included
  438.             external entity.  This avoids duplicating
  439.             material previously included.  It contains
  440.             a NULL message body.  This docment requires, in
  441.             contrast to [ISO-SDIF], that the
  442.             referenced body part have already appeared.
  443.             That requirement enables the user agent to
  444.             display the SGML documents as they are
  445.             encountered.
  446.  
  447. The subdoucment and text SDIF entities become Application/SGML
  448. body parts and data entities are encapsulated as the appropriate
  449. MIME content type.  The last two entities have null message bodies
  450. and are handled as parameters, public and cross-reference, of an
  451. Application/SDIF content type.  The syntax is:
  452.  
  453.     application-subtype :=    <existing> / RsdifS sdif-param
  454.  
  455.     sdif-param    :=    ";" "public" "="
  456.                     <an SGML PUBLIC identifier>
  457.                /    ";" "cross-reference" "="
  458.                     <a previous MIME body part>
  459.     <-- the enclosing Multipart/SDIF body part is
  460.     take as the root (level 1) for numbering body
  461.     parts -->
  462.  
  463. SDIF requires the entity name to accompany each entity in the data
  464. stream.  When MIME is used to transfer SDIF data streams the
  465. entity name will be the value of the content description field in
  466. each body part.
  467.  
  468. Since SDIF does not distinguish the parts of a document entity
  469. (declartion,  dtd, and instance) when SGML documents are contained
  470. in a Multipart/SDIF message the document is sent as a single body
  471. part.  The application can apply default values for unspecified declarations
  472. and DTDs.
  473.  
  474. Finally, SDIF uses sequential numbers to uniquely identify each
  475. entity, an entity-identifier in [ISO-SDIF]  and to locate the
  476. position of the first external entity, a first-identifier, of each
  477. document.  These are not necessary when using the methods in this
  478. document but can be derived.  Within a Multipart/SDIF message number
  479. each body part sequentially, starting at 1 with the first
  480. Application/SGML body part.  Note that the only Multipart body
  481. part that can be present in a Multipart/SDIF message is
  482. Mulitpart/Alternative.  That will resolve into a single body part
  483. and shall be treated as though it were a non-multipart body part. 
  484. The subdocument, text and data entities may, in fact, be
  485. Message/External body parts. With the numbering described the
  486. unpacker may, if needed,  build a table to translate body parts into
  487. SDIF entity numbers.
  488.  
  489. 6    Security
  490.  
  491. An SGML parser can be directed to invoke a local process, usually
  492. to format or display a grpahical image.  That capability presents
  493. an opportunity for abuse.  To understand the potential problems
  494. requires understanding two SGML consturcts, entity and notation
  495. statements, presented below.  Capitalized items are literals,
  496. lowercase ones are tokens, and the special characters are markup
  497. escape squences.
  498.  
  499.     <!ENTITY name SYSTEM file NDATA type>
  500.     <!NOTATION type SYSTEM qstring>
  501.  
  502. The document text will refer to name which, in turn, will cause
  503. the application, type, represented by qstring to be invoked. 
  504. Qstring could be the DOS command "delete *.*".
  505.  
  506. To eliminate potential problems it is recommended that the
  507. unpacker replace notation contained within the message with the
  508. appropriate statements for the recipient's environment.  An
  509. implementation may use a local configuration file that identifies
  510. the acceptable types and inform the user of types in the message
  511. that are not available in the local environment.  They could be
  512. replaced by a no-operation NOTATION statement.  It is recommended
  513. that the list of acceptable types be drawn from the MIME set of
  514. types and subtypes.
  515.  
  516. SGML also provides for sending non-interpreted data to the display
  517. device or typesetter.  The security hazard presented is similar to
  518. those posed by the use of PostScript.  Greater threats may be
  519. posed by more "powerful" display systems and typesetters. 
  520. Unautorized access to the recipient's system and resources may be
  521. possible.
  522.  
  523. 7    References
  524.  
  525. [ISO-SGML]    ISO 8879:1988, Information processing -- Text and
  526.         office systems -- Standard Generalized Markup Language
  527.         (SGML).
  528.  
  529. [ISO-SDIF]    ISO 9069:1988, Information Processing - SGML Support
  530.         Facilities -- SGML Document Interchange Format (SDIF).
  531.  
  532. [RFC-822]    Crocker, D., Standard for the Format of ARPA Internet
  533.         Text Messages, August 1982, University of Delaware, RFC
  534.         822.
  535.  
  536. [RFC-HDRC]    Moore, Keith, Representation of Non-Ascii Text in
  537.         Internet Message Headers,  June, 1992, RFC 1522
  538.  
  539. [RFC-MIME]    Borenstein, N. and Freed, N., MIME (Mulitpurpose
  540.         Internet Mail Extensions): Mechanisms for Specifying
  541.         and Describing the Format of Internet Message Bodies,
  542.         June 1992, RFC 1521.
  543.  
  544. [US-ASCII]    Coded Character Set -- 7-Bit American Standard Code for
  545.         Information Interchange, ANSI X3.4-1986.
  546.  
  547. 8    Acknowledgements
  548.  
  549. The author acknowledges Andy Gelsey, Accurate Information Systems,
  550. Inc., Nathaniel Borenstein, Bellcore, Einar Stefferud, Network
  551. Management Asscoiates, Inc, John Klensin, MIT, and Erik Naggum,
  552. for their suggestions, explanations, and encouragement.  No errors
  553. or faults in this document can be ascribed to them, they all
  554. belong to me.
  555.  
  556. UNIX is a registered trademark of UNIX System Laboratories, Inc.
  557.  
  558. 9    Author's Address
  559.  
  560. Ed Levinson
  561. elevinson@accurate.com
  562. Accurate Information Systems, Inc.
  563. 2 Industrial Way
  564. Eatontown, NJ  0772
  565.  
  566. Appendix A.   SGML for IETFers
  567.  
  568. This appendix describes of the elements of the Standard
  569. Generalized Markup Language (SGML) that are key to understanding
  570. the relationship between SGML and the Multipurpose Internet Mail
  571. Extensions (MIME).  For the purposes of this discussion, and
  572. without doing too much damage to the SGML specification, an SGML
  573. document contains text, markup, and references to non-text
  574. document elements (e.g., graphics).  For a complete and accurate
  575. description see ISO 8879, Information Processing - Text and office
  576. systems - Standard Generalized Markup Language (SGML).
  577.  
  578. An SGML document has the following structure (the parenthesized
  579. numbers refer to productions in ISO 8879) and is processed by an
  580. application called an SGML parser.  Note that Internet style ABNF
  581. is used for notation here, [ISO-SGML] uses a different style.
  582.  
  583. sgml-doc    ::=    sgml-decl dtd doc-inst    (2)
  584. sgml-sub-doc    ::=    dtd doc-inst        (3)
  585.  
  586. Sgml-decl defines the various elements and parameters of SGML. 
  587.     For example, the characters that introduce and end
  588.     markup tags, R<R and R>S respectively will be used
  589.     here, the maximum length of markup tags, etc..
  590.  
  591. Dtd    is a document type definition (DTD) which defines the
  592.     structure of the document, most important for interchange
  593.     considerations the DTD contains references to external
  594.     files, system commands, and text to be sent directly to a
  595.     typesetter or printer.
  596.  
  597. Doc-inst is the actual document text; it includes graphic
  598.     elements, other text with or without markup, by reference
  599.     to DTD elements.
  600.  
  601. The remainder of this discussion focuses on two elements which a
  602. DTD uses to reference other things, entities and notations. They
  603. appear in the DTD and have the following format.
  604.  
  605. entity    ::=    "<!" "ENTITY" name e-text ">"    (101)
  606. e-text    ::=    q-string | data | b-text | external    (105)
  607. data    ::=    ( "CDATA" | "SDATA" | "PI" ) q-string    (106)
  608. external    ::=    ext-id ( "SUBDOC" | ( "NDATA" type ))    (108)
  609. ext-id    ::=    ( "SYSTEM"  q-string)  | ( "PUBLIC" pub-id [q- string] )(73)
  610. notation    ::=    "<!" "NOTATION" type ext-id ">"    (148)
  611.  
  612. where name is a character sting, and the definition of b-text left
  613. to ISO 8879; for convenience q-string has been substituted for the
  614. SGML term parameter literal.  Entities referred to via the SUBDOC
  615. keyword differ from SGML documents in that they cannot contain an
  616. sgml-decl.
  617.  
  618. Using the above productions the following sample entities
  619. demonstrate the important issues. Name, xname, and type are alphanumeric
  620. tokens and q-string is a series of characters enclosed in double
  621. (or single) quote marks. 
  622.  
  623. <!ENTITY name PUBLIC pname>    (A)
  624. <!ENTITY name SYSTEM fname>    (B)
  625. <!ENTITY name SYSTEM fname NDATA type>    (C)
  626. <!NOTATION type SYSTEM command>    (D)
  627. <!ENTITY name PI q-string>    (E)
  628.  
  629. Form A refers to a well known or "public" name that the SGML
  630. parser is able to resolve; in the marked up text there will be a
  631. markup item "&name" that directs the parser to include the
  632. corresponding public file.  Similarly, form B corresponds to a
  633. locally known file.  Form C allows the markup text to refer to non-
  634. SGML data, an image for example, and the type parameter must match
  635. the type of a NOTATION element .  The matching element's command
  636. parameter specifies the command which processes the file fname. 
  637. Finally form E, processing instructions, specifies a string of
  638. characters to be sent directly to the output device.
  639.  
  640. These examples give rise to the following issues when the document
  641. is transferred from one environment to another.
  642.  
  643. A    Is the public name known to the recipient?  The recipient SGML
  644.     parser may not know of the public file and this will be
  645.     discovered when it processes the document.
  646.  
  647. B    What is the file name on the recipient system?  There must be
  648.     some process which binds the sender's file names to the
  649.     recipient.
  650.  
  651. C    See B and D.
  652.  
  653. D    Direct use of the NOTATION form is a large security risk, an
  654.     invitation to a Trojan Horse attack.  The recipient must be
  655.     protected from a sender invoking an arbitrary command on the
  656.     recipient system.
  657.  
  658. E    Processing instructions permit the sender to manipulate the
  659.     recipient output device.  This is the same risk that exists for
  660.     PostScript documents and is not addressed.
  661.  
  662. Appendix B.  Content-Type registrations
  663. _________________________________
  664.  
  665. B.1 The Application/SGML Content-Type
  666.  
  667. (1)    MIME type name: Application
  668.  
  669. (2)    MIME subtype name: SGML
  670.  
  671. (3)    Required parameters: none
  672.  
  673. (4)    Optional parameters: declaration, dtd, instance, fosi, charset
  674.  
  675. (5)    Encoding considerations: may be encoded
  676.  
  677. (6)    Security considerations: see RFC section 6
  678.  
  679. (7)    Specification:
  680.  
  681. This subtype is used for text marked with the Standard Generalized
  682. Markup Language.  Body parts of this subtype will contain a
  683. Content-Reference: field if this body part is referred to as a
  684. file by an SGML document or subdocument entity or if it is
  685. explictily referred to in a Multipart/SGML parameter.
  686. _________________________________
  687.  
  688. B.2. The Application/SDIF Content-Type
  689.  
  690. (1)    Mime type name: Application
  691.  
  692. (2)    MIME subtype name: SDIF
  693.  
  694. (3)    Required parameters: one of public or cross-reference
  695.  
  696. (4)    Optional parameters: none
  697.  
  698. (5)    Encoding considerations: none
  699.  
  700. (6)    Security considerations:
  701.  
  702. (7)    Specification:
  703.  
  704. This subtype contains a NULL or empty message body.  The value of
  705. the public parameter is an SGML PUBLIC entity identifier.  The
  706. value of cross-reference is the body part identifier of a
  707. previously occurring body part.
  708. _________________________________
  709.  
  710. B.3.  The Multipart/SGML Content-Type
  711.  
  712. (1)    Mime type name: Multipart
  713.  
  714. (2)    MIME subtype name: SGML
  715.  
  716. (3)    Required parameters: boundary
  717.  
  718. (4)    Optional parameters: declaration, dtd, fosi, instance
  719.  
  720. (5)    Encoding considerations: none
  721.  
  722. (6)    Security considerations: see RFC section 6
  723.  
  724. (7)    Specification:
  725. _________________________________
  726.  
  727. B.4.  The Multipart/SDIF Content-Type
  728.  
  729. (1)    Mime type name: Multipart
  730.  
  731. (2)    MIME subtype name: SDIF
  732.  
  733. (3)    Required parameters: boundary
  734.  
  735. (4)    Optional parameters: charset
  736.  
  737. (5)    Encoding considerations: none
  738.  
  739. (6)    Security considerations: none
  740.  
  741.